package com.lagou.guavacache.task;

import com.lagou.guavacache.service.PostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;

public class PostTask {

    @Autowired
    private PostService postService;

    /**
     * 刷新热门岗位（从redis缓存和数据库中取得投递简历最多的6个岗位）
     * 间隔10秒钟触发（正式应用场景可以设置为1小时）
     */
    @Scheduled(cron = "10 * * * * ?")
    public void refreshHotPosts() {
        postService.refreshHotPosts();
        System.out.println("refresh hotpost");
    }
}
